import 'package:flutter/material.dart';
import 'package:tree_hole/personal/UpdateMotto.dart';
import 'package:tree_hole/personal/UpdateNick.dart';
import 'package:tree_hole/personal/UpdatePsw.dart';

class ModifyUserInfo extends StatefulWidget{

  String token;
  ModifyUserInfo(this.token);

  _ModifyState createState() => _ModifyState();
}

class _ModifyState extends State<ModifyUserInfo> {
  String result;
  @override
  Widget build(BuildContext context){
    return Scaffold(
      appBar: new AppBar(
        title: new Text('修改个人信息',style:TextStyle(color: Colors.black)),
        backgroundColor: Colors.white70,
        leading: IconButton(
          icon:Icon(Icons.arrow_back,color: Colors.black),
          onPressed: () {Navigator.pop(context,result);},
        ),
      ),
      body: Container(
        decoration: BoxDecoration(
          image: new DecorationImage(
            fit: BoxFit.cover,
            image: new AssetImage(
                'images/paper6.jpg'),
          ),
        ),
        child: Center(
            child: Column(
              children: [
                Expanded(
                  flex: 5,
                  child: SizedBox(),),
                Expanded(
                    flex: 2,
                    child: Container(
                        width: 280,
                        child:FlatButton(
                          child: Text("修改昵称",style: TextStyle(fontSize: 16,color: Colors.black),),
                          color: Colors.greenAccent[100],
                          shape: RoundedRectangleBorder(
                              borderRadius: BorderRadius.circular(10)
                          ),
                          onPressed: () async {
                            await Navigator.push(context, MaterialPageRoute(builder: (context) {
                              return UpdateNick(widget.token);
                            }));
                            setState(() {
                              result='pop';
                            });
                          },
                        ))),
                Expanded(
                  flex: 1,
                  child: SizedBox(),),
                Expanded(
                    flex: 2,
                    child: Container(
                        width: 280,
                        child:FlatButton(
                          child: Text("修改寄语",style: TextStyle(fontSize: 16,color: Colors.black),),
                          color: Colors.greenAccent[100],
                          shape: RoundedRectangleBorder(
                              borderRadius: BorderRadius.circular(10)
                          ),
                          onPressed: () async {
                           await Navigator.push(context, MaterialPageRoute(builder: (context) {
                              return UpdateMotto(widget.token);
                            }));
                           setState(() {
                             result='pop';
                           });
                          },
                        ))),
                Expanded(
                  flex: 1,
                  child: SizedBox(),),
                Expanded(
                    flex: 2,
                    child: Container(
                        width: 280,
                        child:FlatButton(
                          child: Text("修改密码",style: TextStyle(fontSize: 16,color: Colors.black),),
                          color: Colors.greenAccent[100],
                          shape: RoundedRectangleBorder(
                              borderRadius: BorderRadius.circular(10)
                          ),
                          onPressed: () async {
                           await Navigator.push(context, MaterialPageRoute(builder: (context) {
                              return UpdatePsw(widget.token);
                            }));
                           setState(() {
                             result='pop';
                           });
                          },
                        ))),
                Expanded(
                  flex: 2,
                  child: SizedBox(),),
              ],
            )
        ),
      ),

    );

  }

}